package com.ithema.method1;

import com.ithema.domain.Student;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class TextDemo_1 {
    public static void main(String[] args) {
        Collection<Student> c=new ArrayList<>();
            Student s1=new Student("刘亦菲",23);
            Student s2=new Student("鞠婧祎",18);
            Student s3=new Student("胡歌",23);
            c.add(s1);
            c.add(s2);
            c.add(s3);
        Iterator<Student> it = c.iterator();
        while (it.hasNext()){
            Student t = it.next();
            System.out.println(t.getName()+"--"+t.getAge());
        }
    }
}
